Use the following functions to analyze or modify text data.
Commands:
^!DirectPrint "Title" Data (added in v4.8)
Prints text directly to the printer, bypassing NoteTab's print procedure. Uses default printer settings. Title is the text shown in the Print manager and Data is the text to send directly to the printer. Data can contain printer control codes.
Functions:
^$CharToDec(Character)$ (added in v4.8)
Returns the decimal value of Character. Example:
^$CharToDec(S)$ -> 83
^$DecToChar(Decimal)$ (added in v4.8)
Returns the character corresponding to the decimal value. Example:
^$DecToChar(83)$ -> S
Note that you should avoid converting the following decimal values 1, 4, 5, and 6 to characters as they have a special meaning for the Clip interpreter.
^$HexToInt(Value)$ (added in v4.52)
Returns the specified hexadecimal value as an integer.
^$IntToHex(Value)$ (added in v4.52)
Returns the specified integer value as an hexadecimal number. In version 4.8, also returns the ANSI hex code of single character if Char does not represent a number.
^$IsAlpha("Str")$ (added in v4.8)
Returns 1 if Str contains only characters from the alphabet, and 0 if it does not.
^$IsAlphaNumeric("Str")$ (added in v4.8)
Returns 1 if Str contains only numbers and characters from the alphabet, and 0 if it does not.
^$IsBlank("Str")$ (added in v4.8)
Returns 1 if Str contains only blank characters (tabs, spacebar, line breaks, etc.), and 0 if it does not.
^$IsCapitalized("Str")$ (added in v4.8)
Returns 1 if Str does not start with a lowercase character and is not followed by any uppercase characters, and 0 if this condition is not met.
^$IsHex(Value)$ (added in v4.52)
Returns 1 if specified text is a hexadecimal number and 0 if it is not.
^$IsLowercase("Str")$ (added in v4.8)
Returns 1 if Str does not contain any uppercase characters, and 0 if it does.
^$IsMixedCase("Str")$ (added in v4.8)
Returns 1 if Str contains both lowercase and uppercase characters, and 0 if it does not.
^$IsNumber(Value)$
Returns 1 if specified text is a number and 0 if it is not.
^$IsUppercase("Str")$ (added in v4.8)
Returns 1 if Str does not contain any lowercase characters, and 0 if it does.
^$RemoveTokens("Str")$
Converts tokens to their corresponding control characters (tabs, carriage returns, etc.)
^$StrAlign("Str";TextWidth;Alignment[;Pad=False])$ (added in v4.9)
This function aligns the Str value within a space specified by TextWidth. Alignment values can be Left, Right, or Center. If the Pad parameter is used, a True value adds blank spaces on the right side of Str (if necessary). Examples:
^$StrAlign("Test";10;Right)$ -> " Test"
^$StrAlign("Test";10;Center;True)$ -> " Test "
^$StrAsciiToAnsi("Str")$ (added in v4.8)
Returns Str with all extended ASCII characters converted to ANSI. This feature uses a conversion table based based on ASCII 850 Multilingual (Latin I).
^$StrAnsiToAscii("Str")$ (added in v4.8)
Returns Str with all extended ANSI characters converted to ASCII. This feature uses a conversion table based based on ASCII 850 Multilingual (Latin I).
^$StrAnsiToOem("Str")$ (added in v4.9)
Returns Str based on ANSI-defined character set converted to OEM.
^$StrCapitalize("Str")$ (added in v4.8)
Capitalizes all words in Str and returns the resulting string.
^$StrCopy("Str";Index;Amount)$
Returns a substring of Str starting at position Index and a size determined by Amount. Example:
^$StrCopy("abcdefghi";4;3)$ -> def
^$StrCopyLeft("Str";Amount)$ (added in v4.82)
Similar to ^$StrCopy()$ but copies the substring from the start of the specified string.
^$StrCopyRight("Str";Amount)$ (added in v4.52)
Similar to ^$StrCopy()$ but copies the substring from the end of the specified string.
^$StrCount("SubStr";"Str";CaseSensitive;WholeWord)$
Returns the number of occurrences of SubStr in Str. Use the CaseSensitive parameter to determine if the match should be case sensitive or not, and WholeWord to indicate that SubStr must only match whole words. Example:
^$StrCount("t";"NoteTab";False;False)$ -> 2
^$StrDecrypt("Text";[Key])$ (added in v4.84)
Decrypts text encrypted with the ^$StrEncrypt("Text";[Key])$ function. You must use the same encryption key to decrypt the text. Example:
^$StrDecrypt("^$GetSelection$";"^?[key=My secret password]")$
^$StrDelete("Str";Index;Amount)$
Returns the resulting string with a deleted portion starting at position Index and a size determined by Amount. Example:
^$StrDelete("abcdefghi";4;3)$ -> abcghi
^$StrDeleteLeft("Str";Amount)$ (added in v4.82)
Similar to ^$StrDelete()$ but deletes the text from the start of the specified string.
^$StrDeleteRight("Str";Amount)$ (added in v4.82)
Similar to ^$StrDelete()$ but deletes the text from the end of the specified string.
^$StrEncrypt("Text";[Key])$ (added in v4.84)
Provides stronger text encryption than ROT13. Use the optional "Key" parameter to define an encryption password (maximum 255 characters and case sensitive). Make sure you don't forget the key you used with this function, otherwise you may never be able to retrieve your encrypted text. Note that although the encryption algorithm is very good, there is no guarantee that it can't be cracked. You should not rely on it to protect very sensitive data. Example:
^$StrEncrypt("^$GetSelection$";"^?[key=My secret password]")$
^$StrFill("Str";Amount)$
Returns a string entirely composed of the defined character or text repeated Amount times. Examples:
^$StrFill(+;4)$ -> ++++
^$StrFill("<>";4)$ -> <><><><>
^$StrFixLines("Str")$ (added in v4.51)
Corrects carriage returns in text criteria (Unix and Mac-formatted text is converted to Dos/Windows format).
^$StrFormat("Str";LeftMargin;TextWidth;Justify)$
Returns the "Str" string in specified format. LeftMargin determines the number of blank spaces to insert between the left margin and the text; TextWidth defines the maximum width of the text in each line; Justify is either True or False and determines if the text is left and right justified. Prior to version 4.8, this command was only available in the commercial and trial versions of NoteTab.
^$StrIndent("Str";IndentSize)$ (added in v4.9)
Returns the Str value with each line indented by IndentSize number of blank characters.
^$StrIndex("Str";Index)$
Returns the character at position Index in Str. Returns an empty string if an invalid Index value is specified. Example:
^$StrIndex("abcdefghi";4)$ -> d
^$StrInsert("SubStr";"Str";Index)$
Returns a string composed of SubStr inserted at position Index in Str. Example:
^$StrInsert("xyz";"abcdefghi";3)$ -> abxyzcdefghi
^$StrInvertCase("Str")$ (added in v4.8)
Converts all uppercase characters to lowercase, and lowercase characters to uppercase, and returns the resulting string.
^$StrLower("Str")$
Returns Str with all characters in lower case. Example:
^$StrLower("ABCdefGHI")$ -> abcdefghi
^$StrOemToAnsi("Str")$ (added in v4.9)
Returns Str based on OEM-defined character set converted to ANSI.
^$StrPos("SubStr";"Str";CaseSensitive)$
Returns the index position of SubStr in Str. Use the CaseSensitive parameter to determine if the match should be case sensitive or not. Returns 0 if there is no match. Tab and line-break tokens are automatically converted to their real characters since version 4.6. Example:
^$StrPos("def";"abcdefghi";True)$ -> 4
^$StrPosMid("SubStr";"Str";StartIndex;CaseSensitive)$ (added in v4.52)
Similar to the ^$StrPos()$ function but starts searching from the specified index position.
^$StrPosRight("SubStr";"Str";CaseSensitive)$ (added in v4.52)
Similar to the ^$StrPos()$ function but searches from right to left.
^$StrRandom(Size)$ (added in v4.84)
^$StrRandom(Size[;Characters])$ (added in v4.85)
Returns a string of random characters of the specified length. This function can be useful for generating random passwords. Example
^$StrRandom(6)$ = È$q3åî
Starting with version 4.85, the StrRandom has been updated to let you optionally define which characters are used in the random string that is generated. The "Characters" parameter represents a string of characters that limits what the function can use in its result. You can define ranges by using "..". For example, A..Z represents all the uppercase letters of the Roman alphabet; A..Za..z0..1 represents all digits and letters of the Roman alphabet. Example:
^$StrRandom(10;A..F0..9)$ --> D744E70176
^$StrReplace("SubStr";"ReplaceStr";"Str";CaseSensitive;WholeWord)$
Returns a new string with all occurrences of SubStr replaced with ReplaceStr according to the settings of the CaseSensitive and WholeWord parameters. Tab and line-break tokens are automatically converted to their real characters since version 4.6. Example:
^$StrReplace("o";"?";"NoteTab Pro";True;False)$ -> N?teTab Pr?
^$StrROT13("Str")$ (added in v4.84)
Performs a ROT13 operation on the specified text. Useful for rendering text unreadable to others. Repeat the function on the text to render it readable again.
^$StrSentenceCase("Str")$ (added in v4.8)
Capitalizes all words following a period, exclamation, and question mark and converts all other words to lowercase.
^$StrSize("Str")$
Returns the size of Str. Example:
^$StrSize("abcdefghi")$ -> 9
^$StrSplit("Str";TextWidth;TrimLines)$ (added in v4.6)
Returns the "Str" string with long lines split at specified width. TextWidth defines the maximum width of the text in each line; TrimLines is either True or False and determines if blank spaces at the end of each line are removed or not.
^$StrSort("Str";CaseSensitive;Ascending;RemoveDuplicates)$ (added in v4.52)
Returns the specified text "Str" sorted according to the defined criteria. For example, the following instruction will sort the lines contained in the Clipboard, in ascending order, ignoring character case, and removing duplicates:
^$StrSort("^$GetClipboard$";False;True;True)$
^$StrStripHTML("Str";PreserveURLs)$ (added in v4.82)
Returns a copy of Str with all HTML tags removed. PreserveURLs is either True or False, and determines if URLs are preserved or not.
^$StrTrim("Str")$
Removes blank spaces from the start and end of the specified value. Example:
^$StrTrim(" some text ")$ returns "some text"
^$StrUpper("Str")$
Returns Str with all characters in upper case. Example:
^$StrUpper("abcdefghi")$ -> ABCDEFGHI
^$StrUrlDecode("Str")$ (added in v4.86c)
Cconverts URL strings and form Mailto data to plain text. Example:
^$StrUrlDecode("C%3A%5CProgram%20Files%5CReadme%2Etxt")$ --> C:\Program Files\Readme.txt
^$StrUUDecode("Str")$ (added in v4.84)
Decodes UUEncoded text converted with the ^$StrUUEncode("Str")$ function. Example:
^$StrDecrypt("^$StrUUDecode("^$GetText$";)$")$
^$StrUUEncode("Str")$ (added in v4.84)
Converts the specified text to 7-bit UUEncoded format. This encoding format is frequently used to send 8-bit data through transmission media (email, for example) supporting only 7-bit data. This function is very useful if you want to send encrypted text by email. Example:
^$StrUUEncode("^$StrEncrypt("^$GetText$";)$")$
Important note: UUencoded text may contain characters that the Clip parser interprets as tokens, like ^p and ^&. As a result, you should use the ^!SetCode command to assign such data to a variable and ^!InsertCode to paste the result of ^$StrUUEncode("Text")$ into a document. See the example in the Utilities library.
^$UseTokens("Str")$
Converts control characters (tabs, carriage returns, etc.) to their corresponding tokens.